package com.example.mapper;

import com.example.entity.Course;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface CourseMapper {
    @Select("select * from course where name like concat('%',#{name},'%') " +
            "and number like concat ('%',#{number},'%') and teacher like " +
            "concat('%',#{teacher},'%') order by id desc")
    List<Course> selectAll(Course course);

    @Insert("insert into course (name,number,despt,time,teacher) value (#{name},#{number},#{despt},#{time},#{teacher})")
    void insert(Course course);
    @Update("UPDATE course SET name = #{name}, number = #{number}, despt = #{despt}, time = #{time}, teacher = #{teacher} WHERE id = #{id}")
    void updataById(Course course);
    @Delete("DELETE from course where id =#{id}")
    void deleteById(Integer id);
}
